package com.itheima.day16反射机制与类加载.反射与类加载.反射类中的构造方法;

import java.lang.reflect.Constructor;

public class Test {
    public static void main(String[] args) throws Exception {
        Class clazz = Class.forName("com.itheima.day16反射机制与类加载.反射与类加载.反射类中的构造方法.Student");
        Constructor[] cons = clazz.getConstructors();
        System.out.println("打印所有的公共的构造方法:");
        for (Constructor con : cons) {
            System.out.println(con);
        }
        System.out.println("打印所有的构造方法:");
        Constructor[] dcons = clazz.getDeclaredConstructors();
        for (Constructor dcon : dcons) {
            System.out.println(dcon);
        }
        System.out.println("打印一个公共的无参构造方法:");
        Constructor con = clazz.getConstructor();
        System.out.println(con);
        System.out.println("打印一个任意的构造方法:");
        Constructor dcon = clazz.getDeclaredConstructor
                (String.class, String.class, int.class);
        System.out.println(dcon);
    }
}
